// 个人中心 地址管理
export const areaRules = {
  address: [
    { required: true, message: '请填写详细地址', trigger: 'change' },
    {
      validator: (rule, value, callback) => {
        if (value.length < 5) {
          callback(new Error('详细地址限制5-60个字'))
        } else if (value.length > 60) {
          callback(new Error('详细地址限制5-60个字'))
        } else {
          callback()
        }
      },
      trigger: 'blur'
    }
  ],
  name: [
    { required: true, message: '请填写收件人', trigger: 'change' }
  ],
  area: [
    { required: true, message: '请选择地区', trigger: 'change' }
  ],
  mobile: [
    {required: true, message: '请输入手机号码', trigger: 'blur'},
    {
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入手机号码'))
        } else if (!(/^1[3456789]\d{9}$/.test(value))) {
          callback(new Error('您输入手机号码不正确'))
        } else {
          callback()
        }
      },
      trigger: 'change'
    }
  ]
}

// 完善资料
export const infoRules = {
  area: [
    { required: true, message: '请选择地区', trigger: 'change' }
  ],
  customerName: [
    { required: true, message: '请输入公司名称', trigger: 'change' }
  ],
  address: [
    { required: true, message: '请输入详细地址', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value.length < 5) {
          callback(new Error('详细地址限制5-60个字'))
        } else if (value.length > 60) {
          callback(new Error('详细地址限制5-60个字'))
        } else {
          callback()
        }
      },
      trigger: 'blur'
    }
  ],
  businessType: [
    { required: true, message: '请选择主营业务', trigger: 'change' }
  ],
  contact: [
    { required: true, message: '请输入联系人', trigger: 'blur' }
  ],
  phone: [
    { required: true, message: '请输入手机号', trigger: 'change' }
  ]
}

// 售后
export const saleAfterRules = {
  saleafterType: [
    { required: true, message: '请选择售后类型', trigger: 'change' }
  ],
  goodStatus: [
    { required: true, message: '请选择货物状态', trigger: 'change' }
  ],
  saleafterCause: [
    { required: true, message: '请选择售后原因', trigger: 'change' }
  ],
  refundExplain: [
    { required: true, message: '请填写原因', trigger: 'blur' }
  ]
}
